package sugarbind_input

class Method {

    String method_Name
	
    static constraints = {
			method_Name(blank:false)
			
			method_Name(unique:true)
	}
	
	static hasMany = [bindings: Binding]
	static belongsTo = Binding
	
	
	static mapping = {
//		id column: 'method_id'
		id generator: 'sequence', params: [sequence: 'method_id_seq']
		
		bindings joinTable: [name: "binding_method", key: 'method_id']
	}
	
	public String toString(){
		method_Name + " ($id)"
	}
	
	public static listMethods()
	{
		Method.list().sort{ it.toString(); }
	}
}
